#include "stdafx.h"
#include "LoadTexture.h"

#include "Renderer.h"

using namespace mgfx;


typedef std::map<std::string, TextureID> ResourceMap;
static ResourceMap mResources;

TextureID mgfx::loadTextureFromFile(const std::string & fileName)
{
	ResourceMap::const_iterator found = mResources.find(fileName);
	if(found != mResources.end())
	{
		return found->second;
	}
	else
	{
		std::string path = "content\\textures\\";
		path += fileName;

		TextureID tex = Renderer::Instance->addTexture(path.c_str());
		mResources[fileName] = tex;

		return tex;
	}
}

